package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ZnProfitHistoryMapper;
import com.ruoyi.system.domain.ZnProfitHistory;
import com.ruoyi.system.service.IZnProfitHistoryService;

/**
 * 盘点计算记录Service业务层处理
 * 
 * @author nexiaozi
 * @date 2022-10-19
 */
@Service
public class ZnProfitHistoryServiceImpl implements IZnProfitHistoryService 
{
    @Autowired
    private ZnProfitHistoryMapper znProfitHistoryMapper;

    /**
     * 查询盘点计算记录
     * 
     * @param id 盘点计算记录主键
     * @return 盘点计算记录
     */
    @Override
    public ZnProfitHistory selectZnProfitHistoryById(Long id)
    {
        return znProfitHistoryMapper.selectZnProfitHistoryById(id);
    }

    /**
     * 查询盘点计算记录列表
     * 
     * @param znProfitHistory 盘点计算记录
     * @return 盘点计算记录
     */
    @Override
    public List<ZnProfitHistory> selectZnProfitHistoryList(ZnProfitHistory znProfitHistory)
    {
        znProfitHistory.setTenantId(SecurityUtils.getTenantId());
        return znProfitHistoryMapper.selectZnProfitHistoryList(znProfitHistory);
    }
     /**
      * 查询盘点计算记录记录数
      *
      * @param znProfitHistory 盘点计算记录
      * @return 盘点计算记录记录数
     */
    public Integer selectZnProfitHistoryCount(ZnProfitHistory znProfitHistory){
        znProfitHistory.setTenantId(SecurityUtils.getTenantId());
        return znProfitHistoryMapper.selectZnProfitHistoryCount(znProfitHistory);
    }


    /**
     * 新增盘点计算记录
     * 
     * @param znProfitHistory 盘点计算记录
     * @return 结果
     */
    @Override
    public int insertZnProfitHistory(ZnProfitHistory znProfitHistory)
    {
       znProfitHistory.setTenantId(SecurityUtils.getTenantId());
        znProfitHistory.setCreateTime(DateUtils.getNowDate());
        return znProfitHistoryMapper.insertZnProfitHistory(znProfitHistory);
    }

    /**
     * 修改盘点计算记录
     * 
     * @param znProfitHistory 盘点计算记录
     * @return 结果
     */
    @Override
    public int updateZnProfitHistory(ZnProfitHistory znProfitHistory)
    {
        return znProfitHistoryMapper.updateZnProfitHistory(znProfitHistory);
    }

    /**
     * 批量删除盘点计算记录
     * 
     * @param ids 需要删除的盘点计算记录主键
     * @return 结果
     */
    @Override
    public int deleteZnProfitHistoryByIds(Long[] ids)
    {
        return znProfitHistoryMapper.deleteZnProfitHistoryByIds(ids);
    }

    /**
     * 删除盘点计算记录信息
     * 
     * @param id 盘点计算记录主键
     * @return 结果
     */
    @Override
    public int deleteZnProfitHistoryById(Long id)
    {
        return znProfitHistoryMapper.deleteZnProfitHistoryById(id);
    }
}
